{$php_begin} include("../../system/include/header_front.php"){$php_end}{$crlf}
{$php_begin} include("../../system/labels/{$tableName}_labels.php"){$php_end}{$crlf}

{$js_include}{$crlf}

<div class="div_entity_edit">

	<FORM name="form1" METHOD="POST" ACTION="{$tableName}_do.php" target="newwin" onsubmit="return check_form(this)">
	<input type="hidden" name="button_id" value="{$php_short_begin}get("button_id"){$php_end}">
	{loop="fields"}{if="$value.common == 1"}
{$value.edit_html}{$crlf}
	{/if}{/loop}

	<TABLE class="table_edit">
	{loop="fields"}{if="$value.hidden == 0"}
<TR>
		<TD class='col_label'>
			<span class='span_star'>{$value.star}</span>{$php_short_begin}label("{$value.label_name}"){$php_end}{$crlf}
		</TD>
		<TD class='col_value'>
			{$value.edit_html}
			<span id='sh_{$value.element_name}' class='span_help'>{$php_short_begin}label("{$value.label_name}.help"){$php_end}</span>
			<span id='se_{$value.element_name}' class='span_error'></span>
		</TD>
	</TR>
	{/if}{/loop}
</TABLE>

	<INPUT TYPE="button" class="btn bcancel" value="{$php_short_begin}label("common.cancel"){$php_end}" onclick="go_url('{$tableName}_list.php')">
	<INPUT TYPE="submit" class="btn bsave"   value="{$php_short_begin}label("common.submit"){$php_end}">
	<INPUT TYPE="reset"  class="btn breset"  value="{$php_short_begin}label("common.reset"){$php_end}">

	</FORM>

</div>

{$php_begin}{$crlf}
if(get("button_id") != ""){
	$sqlstr = "select * from {$tableName} where {$primaryKey}=".get("button_id");
	$result = fullQueryResult($company["db_host"],$company["db_name"],$company["db_user"],$company["db_pass"],$sqlstr,MYSQL_ASSOC);
	print getSpanWithResult($result[0]);
	do_every("document.onload = setFormValue(document.form1);");
}
{$php_end}{$crlf}

{$php_begin} include("../../system/include/footer_front.php"){$php_end}{$crlf}